const db = require('../db/index');
const moment = require('moment');
exports.markScheduleCompleted = (req, res) => {
  const scheduleId = req.params.id;
  const sql = 'UPDATE schedules SET is_completed = true WHERE id = ? AND user_id = ?';
  db.query(sql, [scheduleId, req.user.id], (err, results) => {
    if (err) {
      return res.cc(err);
    }
    if (results.affectedRows !== 1) {
      return res.cc('标记日程完成失败');
    }
    res.cc('标记日程完成成功', 0);
  });
};